package com.xiaohujr.xuexue.javaguide;

import lombok.Data;

public class ObjectSwapTest {

    @Data
    private static class TestStudent{
        private String aa;

        public TestStudent(String aa) {
            this.aa = aa;
        }
    }

    public static void main(String[] args) {
        TestStudent testStudent1 = new TestStudent("1");
        TestStudent testStudent2 = new TestStudent("2");
        swap(testStudent1,testStudent2);

        System.out.println(testStudent1.aa);
        System.out.println(testStudent2.aa);
    }

    private static void swap(TestStudent a1,TestStudent a2){
        TestStudent temp = a1;
        a1 = a2;
        a2 = temp;
        System.out.println("aaa"+a1.aa);
        System.out.println("bbb"+a2.aa);
        a1.setAa("3");
        a2.setAa("4");
    }
}
